import axios from "axios";

//测试代码，不需要时要取消
//axios.defaults.baseURL = "http://localhost:3000";

export function request(url, params) {
  return new Promise((resolve, reject) => {
    axios
      .get(url, params)
      .then(response => {
        resolve(response.data);
      })
      .catch(error => {
        console.log(error);
        reject(error);
      });
  });
}

export default {
  userrole() {
    return request("/getrole");
  },
  adminlist() {
    return request("/get_adminlist");
  },
  rolelist() {
    return request("/get_id_values");
  }
};
